{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from geoscilabs.dcip.DC_Pseudosections import MidpointPseudoSectionWidget, DC2DPseudoWidget\n",
    "from IPython.display import display"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Building Pseudosections \n",
    "\n",
    "2D profiles are often plotted as pseudo-sections by extending $45^{\\circ}$ lines downwards from the A-B and M-N midpoints and plotting the corresponding $\\Delta V_{MN}$, $\\rho_a$, or misfit value at the intersection of these lines as shown below. For pole-dipole or dipole-pole surveys the $45^{\\circ}$ line is simply extended from the location of the pole. By using this method of plotting, the long offset electrodes plot deeper than those with short offsets. This provides a rough idea of the region sampled by each data point, but the vertical axis of a pseudo-section is not a true depth.\n",
    "\n",
    "In the widget below the red dot marks the midpoint of the current dipole or the location of the A electrode location in a pole-dipole array while the green dots mark the midpoints of the potential dipoles or M electrode locations in a dipole-pole array. The blue dots then mark the location in the pseudo-section where the lines from Tx and Rx midpoints intersect and the data is plotted. By stepping through the Tx (current electrode pairs) using the slider you can see how the pseudo section is built up.\n",
    "\n",
    "The figures shown below show how the points in a pseudo-section are plotted for pole-dipole, dipole-pole, and dipole-dipole arrays. The color coding of the dots match those shown in the widget.\n",
    "<br />\n",
    "<br />\n",
    "\n",
    "<img src=\"https://github.com/geoscixyz/geosci-labs/blob/master/images/em/Polepole.png?raw=true\" style=\"width: 60%; height: 60%\"> </img> \n",
    "<center>Basic skematic for a uniformly spaced pole-pole array.\n",
    "<br />\n",
    "<br />\n",
    "<br />\n",
    "<img src=\"https://github.com/geoscixyz/geosci-labs/blob/master/images/em/PoleDipole.png?raw=true\" style=\"width: 60%; height: 60%\"> </img> \n",
    "<center>Basic skematic for a uniformly spaced pole-dipole array.\n",
    "<br />\n",
    "<br />\n",
    "<br />\n",
    "\n",
    "<img src=\"https://github.com/geoscixyz/geosci-labs/blob/master/images/em/DipolePole.png?raw=true\" style=\"width: 60%; height: 60%\"> </img>\n",
    "<center>Basic skematic for a uniformly spaced dipole-pole array. \n",
    "<br />\n",
    "<br />\n",
    "<br />\n",
    "<img src=\"https://github.com/geoscixyz/geosci-labs/blob/master/images/em/DipoleDipole.png?raw=true\" style=\"width: 60%; height: 60%\"> </img>\n",
    "<center>Basic skematic for a uniformly spaced dipole-dipole array.\n",
    "<br />\n",
    "<br />\n",
    "<br />\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "f732fb7d6cce4251a0d21b44ddd48e4a",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "MyApp(children=(IntSlider(value=0, description='i', max=17), Output()), layout=Layout(align_items='stretch', d…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = MidpointPseudoSectionWidget()\n",
    "display(out)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " - **$\\rho_1$**: Resistivity of the halfspace\n",
    " - **$\\rho_2$**: Resistivity of the cylinder\n",
    " - **xc**: x location of cylinder center\n",
    " - **zc**: z location of cylinder center\n",
    " - **r**: radius of cylinder\n",
    " - **surveyType**: Type of survey\n",
    " - **Run Interact**: Use this button to update your plot\n",
    " \n",
    "\n",
    " **Note:** The numerical results shown in this plot are generated from a 2d code such that the  source is a line of current. This greatly speeds up the computation. Accurate potentials obtained from point current sources require the 2.5D code.  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "deed44726946494483e29a80166297fe",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(FloatText(value=1000.0, description='$\\\\rho_1$'), FloatText(value=1000.0, description='$…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = DC2DPseudoWidget()\n",
    "display(out)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  },
  "widgets": {
   "state": {
    "6e3f6835704641c7a49dfd241e063265": {
     "views": [
      {
       "cell_index": 3
      }
     ]
    },
    "8be2bc831de14196a3a3189fddb922bb": {
     "views": [
      {
       "cell_index": 2
      }
     ]
    }
   },
   "version": "1.2.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
